package structure.decorator;

public interface Shape {
	void drow();
}

/**需要被装饰的类*/
class Circle implements Shape {
	/**需要被装饰扩展的方法*/
	@Override
	public void drow() {
		System.out.println("----circle----");
	}
}

/**
 * 基础实现
 */
abstract class ShapeDecorator implements Shape {
	protected Shape decoratedShape;
	public ShapeDecorator(Shape decoratedShape) {
		super();
		this.decoratedShape = decoratedShape;
	}
	@Override
	public void drow() {
		decoratedShape.drow();
	}
}

/**
 * 对基础实现的扩展
 */
class RedShapeDecorator extends ShapeDecorator{
	public RedShapeDecorator(Shape decoratedShape) {
		super(decoratedShape);
	}
	@Override
	public void drow() {
		decoratedShape.drow();
		//一下是修饰扩展 可以对原有逻辑进行扩展
		System.out.println("Border Color: Red");
	}
}